1. Field of the Invention
The invention relates generally to the field of microcontrollers. More particularly, the invention relates to debug interfaces for microcontrollers.
2. Discussion of the Related Art
Background debug, which aids in the development of software in microcontrollers (MCUs), has been in existence since about 1990 and has grown in sophistication. Debug is essential for the software development of most modern MCUs. It usually utilizes a synchronous serial data protocol.
As shown in FIG. 1, a control device, such as a computer 100, is linked to a debug module 110 to debug the software in the MCU 150. A “data in” signal 120 and a clock signal 130 are sent simultaneously from the debug module 110 to the MCU 150, and a data signal 140 is sent back to the debug module 110 from the MCU 150. This data signal 140 is analyzed to detect and correct possible problems in the software in the MCU 150.
FIG. 2 illustrates a system where only one wire is used to communicate in a half-duplex manner between the MCU and the debug module 110, thereby maintaining low costs. Signal waveform 210 of the data in/out signals 200 is illustrated. As directed by the computer 100, the debug module 110 sends and receives from the MCU 150 a binary or bi-level waveform 210. However, because a clock signal is not embedded in the data signal, both the MCU 150 and the debug module 110 needs to receive clock information from another source or the information transmitted between the debug module 110 and the MCU 150 is useless.
As the performance of MCUs increases and the cost simultaneously decreases, it is increasingly necessary to put software debug logic on-chip. In future generations of low cost MCUs, the pin count may be so low that only a single pin may be reserved for use as a debug port. This becomes a problem as IC designers never know what frequency a customer might use, and a clocking signal is important to keep the two modules synchronized.
One example of current technology is a system that is implemented with on-chip hardware rather than external software and provides a full set of debugging options. The control logic resides in an on-chip background debug module (BDM), rather than in a CPU. The BDM generally uses CPU dead cycles to execute debugging commands while the CPU is operating normally but can steal cycles from the CPU when necessary. While the BDM is active, the CPU executes a monitor program located in a small on-chip ROM.
Debugging control logic communicates with external devices serially, via single pin. This single-wire approach helps to minimize the number of pins needed for development support. This pin is an open-drain pin that can be driven either by an MCU or by an external host and is used to send and receive data only. The BDM and the MCU both have their own clocks. However, problems arise when the clock in the BDM becomes out of sync with the clock in the MCU. If this situation arises, the BDM cannot effectively detect any problems that may be present. Thus, synchronization of the MCU and the debug module, without dedicated data, clock, and handshake signals, is a fundamental problem.